<template>
  <div class="app-container">
    <label class="title"
           style="font-size: 20px;color: rgba(0,0,0,.85);font-weight: 600;line-height: 32px">打印日志</label>

    <el-table v-loading="loading" :data="printResult">
      <el-table-column label="序号" type="index" align="center">
        <template slot-scope="scope">
          <span>{{scope.$index+(queryParams.pageNo-1)*queryParams.pageSize+1}}</span>
        </template>
      </el-table-column>

      <el-table-column label="打印人" align="center" prop="printer"/>
      <el-table-column label="打印主机ip" align="center" prop="hostAddress"/>
      <el-table-column label="内容" align="center" prop="content"/>
      <el-table-column label="打印时间" align="center" prop="gmtCreated"/>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNo"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

  </div>
</template>
<script>
  import {
    list
  } from '@/api/business/printResult/printResult'

  export default {
    name: 'printResult',
    data() {
      return {
        // 遮罩层
        loading: true,
        // 导出遮罩层
        exportLoading: false,
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 打印日志表格数据
        printResult: [],
        // 弹出层标题
        title: '',
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNo: 1,
          pageSize: 10,
          main: null
        }
      }
    },
    created() {
      this.getList()
    },
    methods: {
      getList() {
        this.loading = true
        list(this.queryParams).then(response => {
          this.printResult = response.data.records
          this.total = response.data.totalCount
          this.loading = false
        })
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNo = 1
        this.getList()
      },
      /** 重置按钮操作 */
      resetQuery() {
        this.resetForm('queryForm')
        this.handleQuery()
      }
    }
  }
</script>
